package br.srv.full.virtual.faces.manager.userLogin;


import java.util.Date;

import br.srv.full.virtual.entities.resume.UserLogin;
import br.srv.full.zipper.jsf.event.ZipperEvent;

/**
 * @author Carlos Delfino
 * 
 */
public class LoginEvent extends ZipperEvent {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3448789785667440962L;
	
	private UserLogin userLogin;

	private Date date;
	private String event;

	/**
	 * @param p_eventName
	 * @param p_date
	 * @param p_loginManager
	 * @param p_userLogin
	 */
	public LoginEvent(Date p_date, String p_eventName, Object p_loginManager, UserLogin p_userLogin) {
		super(p_loginManager);
		date = p_date;
		event = p_eventName; 
		userLogin = p_userLogin;
	}

	/**
	 * @return the userLogin
	 */
	public UserLogin getUserLogin() {
		return userLogin;
	}

	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * @return the event
	 */
	public String getEvent() {
		return event;
	}

	/**
	 * @param p_event
	 * @return
	 */
	public boolean isEvent(String p_event) {
		if (p_event == null || p_event.equals(""))
			return false;
		else if (USER_ADD_ROLES.equals(p_event))
			return true;
		else if (USER_REMOVE_ROLES.equals(p_event))
			return true;
		else if (USER_LOGIN.equals(p_event))
			return true;
		else if (USER_LOGOFF.equals(p_event))
			return true;
		return false;
	}

	public static final String USER_ADD_ROLES = "USER ADD ROLES";

	public static final String USER_LOGOFF = "USER LOGOFF";

	public static final String USER_REMOVE_ROLES = "USER REMOVE ROLES";

	public static final String USER_LOGIN = "USER LOGIN";

}
